package com.cskaoyan.servlet;

import com.cskaoyan.bean.StatUserData;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.GoodsStatVo;
import com.cskaoyan.bean.vo.OrderStatVo;
import com.cskaoyan.common.CommonServlet;
import com.cskaoyan.service.StatService;
import com.cskaoyan.service.impl.StatServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@WebServlet("/admin/stat/*")
public class AdminStatServlet extends CommonServlet {

    StatService statService = new StatServiceImpl();

    //用户统计
    public BaseRespVo user(HttpServletRequest request, HttpServletResponse response) {
        StatUserData data = statService.user();
        return BaseRespVo.ok(data);
    }

    //订单统计
    public BaseRespVo order(HttpServletRequest request, HttpServletResponse response)
    {
        //统计业务
        OrderStatVo data  = statService.orderStat();

        //返回响应
        return BaseRespVo.ok(data);
    }


    //商品统计
    public BaseRespVo goods(HttpServletRequest request, HttpServletResponse response)
    {
        //统计业务
        GoodsStatVo data  = statService.goodsStat();

        //返回响应
        return BaseRespVo.ok(data);
    }

}
